import 'package:get/get.dart';
import 'package:share_fit/app/controllers/device/device_const.dart';

import 'time_slot_state.dart';

class TimeSlotLogic extends GetxController {
  final TimeSlotState state = TimeSlotState();

  void setTimeSlotEnable(value) {
    state.isTimeSlotEnable.value = value;
  }

  void setStartTime(value) {
    state.startTime.value = value;
    state.changed.value = true;
  }

  void setEndTime(value) {
    state.endTime.value = value;
    state.changed.value = true;
  }

  void onDidPop(didPop) {
    if (!didPop) {
      var result = {"startTime": state.startTime.value, "endTime": state.endTime.value, DeviceConst.changed: true};
      Get.back(result: result);
    }
  }
}
